
// import sotre from 'store'

// import Vue from 'vue'
// import VueRouter from 'vue-router'
// import Login from 'views/Login.vue'
const Login = ()=>import("views/Login.vue")
// import Blogs from 'views/Blogs.vue'
const Blogs = ()=>import("views/blog/Blogs.vue")
// import BlogEdit from 'views/BlogEdit.vue'
// const BlogEdit = ()=>import('views/BlogEdit.vue')
// import BlogDetail from 'views/BlogDetail.vue'
const BlogDetail = ()=>import('views/blog/BlogDetail.vue')
// import Home from 'views/home'
const Home = ()=>import('views/home')

const Newest = ()=>import('views/blog/components/Newest')
Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'Index',
    redirect: {name: "Home"}
  },
  {
    path: '/home',
    name: 'Home',
    component: Home
  },
  {
    path: '/blog',
    name: 'Blog',
    component: ()=>import("views/blog"),
    children: [
      {
        path: '/blog',
        redirect: {name: "Newest"}
      },
      {
        path: '/blog/blogs',
        name: 'Blogs',
        component: Blogs,
        children: [
          {path: '/blog/blogs', redirect: {name: "Newest"}},
          {path: '/blog/blogs/newest', name: 'Newest', component: Newest},
          {path: '/blog/blogs/:class', component: ()=>import("views/blog/components/ClassBlog")}
        ]
      },
      {
        path: '/blog/blogDetail/:blogId',
        name: 'BlogDetail',
        component: BlogDetail
      }
    ]
  },
  {
    path: '/note/:title',
    name: "Note",
    component: ()=>import("views/note")
  },
  {
    path: '/console',
    name: 'Console',
    component: ()=>import("views/back/console"),
    children: [
      {path: "/console", redirect: {name: 'BlogManager'}},
      {path: "/console/blog", name: "BlogManager", component: ()=>import("views/back/blog"),meta: {requireAuth: true}},
      {path: "/console/blog/add", name: "BlogAdd", component: ()=>import("views/back/blog/BlogEdit")},
      {path: "/console/blog/edit/:blogId", name: "BlogUpdate", component: ()=>import("views/back/blog/BlogEdit")},
      {path: "/console/note", name: "NoteManager", component: ()=>import("views/back/note")}
    ],
    meta: {
      requireAuth: true
    }
  },
  // {
  //   path: '/blogs',
  //   name: 'Blogs',
  //   component: Blogs
  // },
  {
    path: '/login',
    name: 'Login',
    component: Login
  },
  // {
  //   path: '/blog/add',
  //   name: 'BlogAdd',
  //   component: BlogEdit,
  //   meta: {
  //     requireAuth: true
  //   }
  // },
  // {
  //   path: '/blog/:blogId',
  //   name: 'BlogDetail',
  //   component: BlogDetail
  // },
  // {
  //   path: '/blog/:blogId/edit',
  //   name: 'BlogEdit',
  //   component: BlogEdit,
  //   meta: {
  //     requireAuth: true
  //   }
  // }
]



const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
